/*****************************************************************************
 * relay.h
 *
 * Copyright (C) 2020 Jeasonvor 1101627719@qq.com
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 ****************************************************************************/
#ifndef __RELAY_H__
#define __RELAY_H__

/*****************************************************************************
 * Included Files
 ****************************************************************************/

/*****************************************************************************
 * Pre-processor Definitions
 ****************************************************************************/

/*****************************************************************************
 * Public Types
 ****************************************************************************/

/*****************************************************************************
 * Public Data
 ****************************************************************************/

/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
 * Public Function Prototypes
 ****************************************************************************/

/**
 * @brief:  继电器初始化
 *
 * @param:
 *
 * @return: 返回执行状态
 * **/
plum_s32 dev_relay_init(plum_void);

/**
 * @brief:  打开继电器
 *
 * @param[in]:  id      -       从站ID
 * @param[in]： idx     -       继电器索引
 *
 * @return: 返回执行状态
 * **/
plum_s32 dev_relay_on(plum_u8 id, plum_u32 idx);

/**
 * @brief:  关闭继电器
 *
 * @param[in]:  id      -       从站ID
 * @param[in]:  idx     -       继电器索引
 *
 * @return: 返回执行状态
 * **/
plum_s32 dev_relay_off(plum_u8 id, plum_u32 idx);

/**
 * @brief: 读继电器开合状态
 *
 * @param[in]:  id      -   modbus总线ID
 * @param[in]:  idx     -   继电器索引编号
 *
 * @return: 返回当前继电器开合状态
 */
plum_bit dev_relay_read(plum_u8 id, plum_u32 idx);

/****************************************************************************/
#ifdef __cplusplus
}
#endif
/****************************************************************************/
#endif /* __RELAY_H__ */
/****************************************************************************/
/*                                                                          */
/*  End of file.                                                            */
/*                                                                          */
/****************************************************************************/
